<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/templates/_template.xhtml">

        <ui:define name="titulo">

            <h3>Consulta de Contas</h3>

        </ui:define>

        <ui:define name="conteudo">

            <p:growl autoUpdate="true" />
            <h:form>

                <p:messages id="messages" autoUpdate="true" />
                <p:dataTable id="tabConta" value="#{contaBean.listaContas}"  var="conta" rows="10" paginator="true" emptyMessage="Não existem contas cadastrados">
                    <p:column>
                        <f:facet name="header">Código</f:facet>
                        <h:outputText value="#{conta.codigo}" />
                    </p:column>
                    
                    <p:column>
                        <f:facet name="header">Descrição</f:facet>
                        <h:outputText value="#{conta.descricao}"/>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Saldo</f:facet>
                        <h:outputText value="#{conta.saldo}"/>
                    </p:column>
                </p:dataTable> 
                <p:commandButton value="Voltar" action="#{contaBean.novo()}" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>